home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Java for 3D & VRML Worlds
/
Java for 3d and VRML Worlds.iso
/
doc
/
homepage
/
tutorials
/
lesson2
/
conemove.java
< prev
next >
Wrap
Text File
|
1996-08-26
|
831b
|
29 lines
import vrml.*;
import vs.*;
public class conemove extends Script {
SFRotation theRot = (SFRotation)getEventOut("theRot");
float newTrans[] = new float[4];
float transPt[] = new float[3];
public conemove() {
newTrans[0] = 1; // axis around which to rotate
newTrans[1] = 0; // "
newTrans[2] = 0; // "
newTrans[3] = 0; // angle to rotate by (in radians)
}
public void clicked(ConstSFBool ev, ConstSFTime time) {
if (ev.getValue() == true) { // if mouse is clicked DOWN, ignore
return;
}
else { // if mouse is clicked UP, perform the rotation
newTrans[3] += 0.314f; // angle
if(newTrans[3] > 6.284f)
newTrans[3] -= 6.284f; // pin to the range 0-360 degrees
theRot.setValue(newTrans);
}
}
}